package com.accesshollywood.grfxOrdering.basics;

import java.util.ArrayList;

import javax.swing.DefaultListModel;

import com.accesshollywood.grfxOrdering.GRFXOrdersMain;
import com.accesshollywood.indexables.GrfxOrder;

public class GrfxOrderListModel extends DefaultListModel {

	public GrfxOrderListModel() {
		super();
	}

	public void refresh(ArrayList<Integer> orderNumbers) {
		this.removeAllElements();
		if (orderNumbers != null) {
			for (int i = 0; i < orderNumbers.size(); i++) {
				GRFXOrdersMain.pBarDlg.pBar.setValue(i);
				GrfxOrder newOrder = new GrfxOrder();
				newOrder.fromSQL(orderNumbers.get(i));
				this.addElement(newOrder);
			}
		}
	}

}
